package dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author fire'ge
 */
public class PageOperation {
    public static ResultSet checkPage(String tableName,Connection connection) throws SQLException {
        String sql = "select count(*) from ";
        sql = sql+tableName;
        PreparedStatement ps = connection.prepareStatement(sql);
        return ps.executeQuery(sql);

    }
    public static ResultSet checkLikePage(String factorStr,Connection connection) throws SQLException {
        //获取记录
        String sql = "select count(*) from tb_user where username like ?";
        PreparedStatement ps2 = connection.prepareStatement(sql);
        factorStr = "%"+factorStr+"%";
        ps2.setNString(1,factorStr);
        return  ps2.executeQuery();
    }
}
